package com.example.demo.mapper;

import org.apache.ibatis.annotations.Mapper;
import com.example.demo.model.Teacher;

import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface TeacherMapper {
    @Select("select * from teacher")

    List<Teacher> findAll();


    @Select("select * from teacher where tel = #{tel}")

    List<Teacher> findByTel(String tel);


    @Select("select * from teacher where id = #{id}")

    Teacher get(Integer id);


    @Delete("delete from teacher where id = #{id}")

    void delete(Integer id);


    @Insert("insert into teacher(id, name, age, tel) values(#{id}, #{name}, #{age}, #{tel})")

    void save(Teacher teacher);


    @Update("update teacher set name = #{name}, age = #{age}, tel = #{tel} where id = #{id}")

    void update(Teacher teacher);


    //@Select("select * from teacher where name = #{name} and tel = #{tel}")

    List<Teacher> search(Teacher teacher);
}
